<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
//        $a=1;
//        $b="china";
//        echo $a+$b;
//        $c=123.45;
//        echo "<br/>";
//        echo (int)$c;
//        define("PI",3.1415926);
//        echo "<br/>";
//        echo PI;
//        echo "<br/>";
//        echo "File;".__FILE__."<br/>"
//                . "CLASS;".__CLASS__."<br/>";
//        $word="I love";
//        $word.=$b;
//        echo "<br/>".$word;
//        $word2=5>3?"True":"False";
//        if($a>10){
//            echo "a<10";
//        }echo if($a<0){
//            echo "a<0";
//        }
//        else{
//            echo "0<a<10";
//        }
        
        switch ($a) {
            case 1:
                echo "a=1";
                break;
            case 2:
                break;
            case 3;
                break;
            default:
                break;
        }
        
        
        $arr1=array("china",1,123.5,'computer','中国人',false);
        echo "<hr>";
        echo "<hr>";
        echo $arr1[0]."<br/>".$arr1[1]."<br/>".$arr1[3];
        echo "<hr>";
        for($index=0;$index<6;$index++){
            echo $arr1 [$index]."<br/>";
        }
        
        $arr2=array('a'=>"china",'b'=>2,0=>"c",1=>"A");
        echo "<hr>";
        echo $arr2[0];
        echo "<hr>";
        echo $arr2[1];
        echo "<hr>";
        
        //$key $v 是迭代的变量 不能修改
        foreach ($arr2 as $key=>$v){
            echo "<br>";
            echo $key."--->".$v;
            $srr2[$key].="new"; //修改数值中的值
            //$key=$key."new";
            
        }
        echo "<hr>";
        foreach ($arr2 as $key=>$v){
            echo "<br/>";
            echo $key."--->".$v;
        }
        // 对$arr2中所有元素进行遍历 对key小于100的 在value后面加上 字符串 “小于100"
        foreach ($arr2 as $k1=>$v1){
            if($k1<100){
                $arr2[$k1].="小于100";
            }
        }
        echo "<hr>";
        foreach ($arr2 as $key=>$v){
            echo "<br/>";
            echo $key."--->".$v;
        }
        $arr3 =array(10,2,3,4,6,5,7,0);
        rsort($arr3);//升序排序
        echo "<br>/";
        for ($index=0;$index<7;$index++){
            echo $arr3[$index]."---";
        }
        echo "<br/>";
        rsort($arr3);//降序排序
        for ($index=0;$index<7;$index++){
            echo $arr3[$index]."---";
        }
        echo "<br/>";
        rsort($arr2);
        foreach ($arr2 as $key=>$v){
            echo "  ".$key."--->".$v;
        }
        echo "<br/>";
        echo "<br/>";
        ksort($arr2);
        foreach ($srr2 as $key=>$v){
            echo "  ".$key."--->".$v;
        }
        echo "<br/>";
        for ($i=1;$i<=9;$i++){
            for ($j=1;$j<=$i;$j++)
                echo $i.'*'.$j.'='.$i*$j.' ';
            echo'<br>';
        }
        // put your code here
        ?>
    </body>
</html>
